package com.eptok.weixin.util;

import java.io.FileNotFoundException;
import java.io.IOException;

import org.apache.poi.POIXMLDocument;
import org.apache.poi.POIXMLTextExtractor;
import org.apache.poi.openxml4j.opc.OPCPackage;
import org.apache.poi.xwpf.extractor.XWPFWordExtractor;
import org.apache.poi.xwpf.usermodel.XWPFDocument;

public class WordTest {
	public static void main(String args[]) throws Exception {
//		new WordTest().readWord2007();
		new WordTest().readWord2003();
	}

	private void readWord2007() {
        try {
            OPCPackage oPCPackage = POIXMLDocument.openPackage("c://c2007.docx");
            XWPFDocument xwpf = new XWPFDocument(oPCPackage);
            POIXMLTextExtractor ex = new XWPFWordExtractor(xwpf);
            System.out.print(ex.getText());
           oPCPackage.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();  
        } catch (IOException e) {  
            e.printStackTrace(); 
        }
	}
	
	private void readWord2003() {}
}	
